package com.freejy.ecommunity.utils;

public enum OsType
{

	OTHER(0, "other"),
	
	ANDROID(1, "android"),

	IPHONE(2, "ios"),
	
	PC(3, "pc");


	private int value;
	private String text;

	OsType(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public int getValue() {
		return value;
	}
	
	public String getText() {
		return text;
	}

	public static OsType getEnum(Integer val) {
		for (OsType v : values()){
			if (v.getValue()==val){
				return v;
			}
		}
//		throw new IllegalArgumentException("Unknown OsType Value: " + val);
		return null;
    }

	public static OsType getEnum(String text) {
		for (OsType v : values()){
			if (v.getText().equals(text)){
				return v;
			}
		}
//		throw new IllegalArgumentException("Unknown OsType Value: " + val);
		return null;
    }
}
